from api import log
from config import HOST


# 投资api
class ApiTender:
    # 初始化
    def __init__(self, session):
        # 获取session对象
        self.session = session
        # 投资url
        self.__url_tender = HOST + "/trust/trust/tender"

    # 投资接口 封装
    def url_tender(self, id, amount):
        data = {
            "id": id,
            "depositCertificate": -1,
            "amount": amount
        }
        # 发送投资请求
        log.info("正在调用 后台投资接口 ,请求方法:{} ,url:{}, 参数为:{}".format("post", self.__url_tender, data))
        return self.session.post(url=self.__url_tender, data=data)
